package com.daodai.hjcjhsystemtd.config;
import com.daodai.hjcjhsystemtd.utils.OpcUaClientUtil;
import lombok.RequiredArgsConstructor;
import org.eclipse.milo.opcua.sdk.client.OpcUaClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * <p>
 *  opc客户端配置类
 * </p>
 *
 * @author 汪川贵
 * @since 2025-09-06
 */
@RequiredArgsConstructor
@Configuration
public class OpcUaConfig {

    private final OpcUaProperties opcUaProperties;
    private final OpcUaClientUtil opcUaClientUtil;


    @Bean(name = "opcUaClient37800")
    public OpcUaClient opcUaClient37800() throws Exception {
        return opcUaClientUtil.connectOpcUaServer(opcUaProperties.getEndPointUrl37800());
    }

    @Bean(name = "opcUaClient37801")
    public OpcUaClient opcUaClient37801() throws Exception {
        return opcUaClientUtil.connectOpcUaServer(opcUaProperties.getEndPointUrl37801());
    }
}
